<?php

/**
 * Disbursement form base class.
 *
 * @package    form
 * @subpackage disbursement
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseDisbursementForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'contract_id'         => new sfWidgetFormDoctrineSelect(array('model' => 'Contract', 'add_empty' => false)),
      'date'                => new sfWidgetFormDate(),
      'release_amount'      => new sfWidgetFormInput(),
      'disbursement_amount' => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorDoctrineChoice(array('model' => 'Disbursement', 'column' => 'id', 'required' => false)),
      'contract_id'         => new sfValidatorDoctrineChoice(array('model' => 'Contract')),
      'date'                => new sfValidatorDate(array('required' => false)),
      'release_amount'      => new sfValidatorNumber(array('required' => false)),
      'disbursement_amount' => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('disbursement[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Disbursement';
  }

}